package com.ttedu.database.service.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ttedu.database.dao.typesMapper;
import com.ttedu.database.model.types;
import com.ttedu.database.model.typesExample;
import com.ttedu.database.model.typesExample.Criteria;
import com.ttedu.database.service.TypesService;
import com.ttedu.util.StringUtil;
import com.ttedu.util.Validator;
@Service
public class TypesServiceImpl implements TypesService{
	@Autowired
	private typesMapper typesmapper;
	public List<types> selectTypesAll(Map map){
		return typesmapper.selectTypesAll(map);
	}
	public int selectTypesCount(Map map){
		typesExample example=new typesExample();
		Criteria criterion=example.createCriteria();
		if(Validator.isNotNull(map.get("name"))){
			criterion.andNameLike(StringUtil.ObjectToString(map.get("name")));
		}
		return typesmapper.countByExample(example);
	}
	public types selectByPrimaryKey(int id){
		return typesmapper.selectByPrimaryKey(id);
	}
	public void insert(types type){
		typesmapper.insert(type);
	}
	public void updateByPrimaryKey(types type){
		typesmapper.updateByPrimaryKey(type);
	}
	public void deleteByPrimaryKey(int id){
		typesmapper.deleteByPrimaryKey(id);
	}
}
